using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NTTHAO.Web.BL.CommonPage;
using NTTHAO.CommonWeb;
using System.Collections.Generic;

public partial class Sites_Vigor_Webparts_Pages_News : NTTHAO.CommonWeb.CommonUserControl
{
    public CommonPageGroup _Group = null;
    public CommonMenu _RootMenu = null;
    public CommonMenu _CurrentMenu = null;
    public List<CommonMenu> _MenuPath = new List<CommonMenu>();

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            _Group = this.GetCurrentPageGroup();
            _RootMenu = this.GetRootMenu();
            _CurrentMenu = this.GetCurrentMenu();

            CommonMenu menu = _CurrentMenu;
            while (menu != null)
            {
                _MenuPath.Insert(0, menu);
                menu = CommonMenu.GetCommonMenu(menu.ParentID);
            }


            string controlName = String.Empty;
            try
            {
                if (Request.QueryString["id"] != null)
                {
                    controlName = "../Common/NewsDetail.ascx";
                }
                if (controlName == String.Empty)
                {
                    controlName = "../Common/NewsList.ascx";
                }

                Control ctrl = this.LoadControl(controlName);
                this._Cont.Controls.Add(ctrl);
            }
            catch (Exception ex)
            {
                HtmlGenericControl ctrl = new HtmlGenericControl("div");
                ctrl.InnerHtml = "<p>" + ex.Message.Replace(Environment.NewLine, "<br />") + "</p>" + "<p>" + ex.Message.Replace(Environment.StackTrace, "<br />") + "</p>";
                this._Cont.Controls.Add(ctrl);
            }
        }
        catch { }
    }
}
